/*
 * Copyright (c) 2020 - present, Inspur Genersoft Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.manager;


import com.inspur.edp.caf.generator.item.ClassGeneratorContext;
import com.inspur.edp.caf.generator.method.ClassMethodGenerator;
import com.inspur.edp.cef.gencommon.MediateType;
import com.inspur.edp.cef.generator.coreGenerator.base.mgrGenerator.ValueObjManagerGenerator;
import com.inspur.edp.cef.generator.coreGenerator.base.mgrGenerator.method.ValueObjGetRepositoryMethodGenerator;
import com.inspur.edp.cef.variable.core.manager.AbstractVariableManager;
import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.manager.repository.VarRepositoryPropertyGenerator;
import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.manager.serialize.GetChangeDeserGenerator;
import com.inspur.edp.cef.variable.dtgenerator.core.rtgenerator.manager.serialize.GetChangeSerializerGenerator;
import java.util.List;

public class VarManagerImplGenerator extends ValueObjManagerGenerator
{
	private VarMgrGenContext mgrGenCtx;
	public VarManagerImplGenerator(VarMgrGenContext mgrGenCtx)
	{
		super(mgrGenCtx);
		this.mgrGenCtx = mgrGenCtx;
	}

	@Override
	protected void doInitialize()
	{
		super.doInitialize();
		mgrGenCtx.getVarGenerateContext().setVariableMgrType(new MediateType(mgrGenCtx.getVarGenerateContext().getNameSpace(), getName()));
	}

	@Override
	protected String getName() {
		return mgrGenCtx.getVarGenerateContext().getCefGenContext().getCommonVariableEntity().getCode() + "Manager";
	}

	@Override
	protected Class getImplParentClassType() {
		return AbstractVariableManager.class;
	}

	@Override
	protected List<ClassMethodGenerator> getMgrActionGenerators() {
		return null;
	}

	@Override
	protected ClassGeneratorContext createClassInfoContext()
	{
		return new MgrImplGenCtx(mgrGenCtx);
	}

	@Override
	protected void addExtendMethodGenerator(java.util.ArrayList<ClassMethodGenerator> generators)
	{
		super.addExtendMethodGenerator(generators);
		generators.add(new CreateAbstractUdtGenerator(mgrGenCtx));
		generators.add(new GetChangeSerializerGenerator(mgrGenCtx));
		generators.add(new GetChangeDeserGenerator(mgrGenCtx));
	}

	@Override
	protected ValueObjGetRepositoryMethodGenerator createValueObjRepoPropertyGenerator()
	{
		return new VarRepositoryPropertyGenerator(mgrGenCtx.getVarGenerateContext());
	}
}
